<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<title>神经学组病例读片会</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<!-- 优先使用 IE 最新版本和 Chrome -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<!-- 启用360浏览器的极速模式(webkit) -->
	<link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
	<!-- 添加 favicon icon -->
	<meta name="renderer" content="webkit">
	<link rel="stylesheet" href="css/public.css" />
	<link rel="stylesheet" href="css/reset1.css" />
	<script src="js/font-size.js" type="text/javascript"></script>
	<script src="js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript">

  var isSuccess = 1;

  function phoneCheck(){
	 
	 var phone = $.trim( $("#phone").val() );
	 
	 if( phone.length == 0)  
     {  
         $("#error").text("手机不能为空！");
         $("#error").css({"color":"red"}); 
         isSuccess = 0 ;
     } else {
    	 var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
         if(!myreg.test( phone )) 
         { 
         	$("#error").text("请输入正确格式的手机号!");
         	$("#error").css({"color":"red"}); 
         	isSuccess = 0 ;
         }else {
        	 $.ajax( {
     			url : "phoneCheck?phone=" + phone , 
     			type : 'post' ,
     			async: false , //必须设置同步 , 因为 通过了此判断才能提交 action
     			datatype : 'json' , 
     			success : function( data ){
     				if ( data.length > 0 ) {
     					$("#error").text("当前手机号已经被注册,请重新输入!");
     					$("#error").css({"color":"red"});
     					isSuccess = 0 ;
     				} else {
     					$("#error").text("");
     					isSuccess = 1 ;
     				}
     				
     			} ,
     			error : function(){
     				alert( '加载失败' );
     			}
     			
     	});
       }
		    	 
    	 
     }
	 
  }
  
  function nameCheck(){
	  var txt_name = $.trim($("#name").val());
	  if( txt_name.length == 0)
      {   
		  isSuccess = 0 ;
          $("#error").text("姓名不能为空！");
          $("#error").css({"color":"red"});  
      } else {
    	  $("#error").text("");
    	  isSuccess = 1 ;
      }
  }
  
  function hospitalCheck(){
	  var txt_hospital = $.trim($("#hospital").val() );
	  if( txt_hospital.length == 0)  
      {  
		  isSuccess = 0 ;
          $("#error").text("医院不能为空！");
          $("#error").css({"color":"red"});  
      }else {
    	  $("#error").text("");
    	  isSuccess = 1 ;
      }
  }
  

$(document).ready(function(){
	
    $("#registerID").bind("submit", function(){
		
    	nameCheck();
    	if(isSuccess == 0)  
        {  
            return false;  
        }
    	
    	phoneCheck();
    	if(isSuccess == 0)  
        {  
            return false;  
        }
    	
    	hospitalCheck();
    	if(isSuccess == 0)  
        {  
            return false;  
        }
				        
        })
})
</script>
</head>

<body >

	<div class="wap_phone">
    	<div class="wap">
        	<h5><span id="error" style="font-size:20px"></span></h5>
        	<form id="registerID" action="register" name="Search">
            	<p><img src="img/name.png"><input type="text" class="name" name="name"  id="name" value=""  onblur="nameCheck();" ></p>
                <p><img src="img/ph_bj.png"><input type="text" class="phone" name="phone" id="phone" value="" onblur="phoneCheck();"></p>
                <p><img src="img/ho_bj.png"><input type="text" class="hospital" id="hospital" name="hospital" value="" onblur="hospitalCheck();"></p>
                <h4>
                	<input type="submit" value="" >
                </h4>
            </form>
        </div>
    </div>
	
</body>
	<script>
    	var t=$(window).height()
		$('.wap_phone').css('height',t+'px')
    </script>
</html>